package com.example.mytayunapi.Mapper;


import com.example.mytayunapi.Entity.recent_browseInfo;
import com.example.mytayunapi.Vo.ProductBrowseInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface recent_browseInfoMapper {

    @Insert("INSERT INTO recent_browse(Product_id, School_degree) VALUES (#{Product_id}, #{School_degree})")
    Integer recent_browseInfo(recent_browseInfo recent_browseInfo);

    @Select("SELECT p.Product_name, p.category, p.Product_price, p.Product_id,p.Product_image, rb.Browse_time " +
            "FROM recent_browse rb " +
            "JOIN products p ON rb.Product_id = p.Product_id " +
            "WHERE rb.School_degree = #{School_degree}")
    List<ProductBrowseInfo> findProductBrowseInfoBySchoolDegree(String School_degree);
}
